/**
 * 
 */
package br.edu.ufcg.embedded.domain;

import org.jgrapht.Graph;
import org.jgrapht.graph.DefaultDirectedGraph;
import org.jgrapht.graph.DefaultEdge;


/**
 * @author daniel
 *
 */
public class DirectedGraphBuilder {
	
	private DefaultDirectedGraph<String, DefaultEdge> graph;
	
	public DirectedGraphBuilder()
	{
		graph = new DefaultDirectedGraph<String, DefaultEdge>(DefaultEdge.class);
	}
	
	public boolean add(String v1) {
		return graph.addVertex(v1);
	}
	
	public boolean addEdge(String v1, String v2)
	{
		return graph.addEdge(v1, v2) != null;
	}
	
	public Graph<String, DefaultEdge> getGraph() {
		return graph;
	}
	
	public int getVerticesSize() {
		
		return graph.vertexSet().size();
	}
}
